package com.gopay.common.util.xml.utils;

import java.util.List;

public class Assert0{
	
	public static void notNull(Object object) {
		notNull(object, "[Assertion failed] - this argument is required; it must not be null");
	}
	
	public static void notNull(Object object, String message) {
		if (object == null) {
			throw new IllegalArgumentException(message);
		}
	}
	
	public static void empty4String(String str) {
		if(str != null && str.length() > 0){
			throw new IllegalArgumentException("[Assertion failed] - the str argument must be empty");
		}
	}
	public static void notEmpty4String(String str) {
		notEmpty4String(str, "[Assertion failed] - this str argument is empty; it must not be empty");
	}
	
	public static void notEmpty4String(String str, String message) {
		if(str == null || str.length() == 0){
			throw new IllegalArgumentException(message);
		}
	}
	
	
	public static void empty4List(List<?> list) {
		if(list != null && !list.isEmpty()){
			throw new IllegalArgumentException("[Assertion failed] - the list argument must be empty");
		}
	}
	public static void notEmpty4List(List<?> list) {
		notEmpty4List(list, "[Assertion failed] - this list argument is empty; it must not be empty");
	}
	
	public static void notEmpty4List(List<?> list, String message) {
		if(list == null || list.isEmpty()){
			throw new IllegalArgumentException(message);
		}
	}
	
	public static void equals(Object obj1, Object obj2) {
		boolean isE = obj1 == null ? obj2 == null : obj1.equals(obj2);
		if(!isE){
			throw new IllegalArgumentException("obj1 must be equals obj2");
		}
	}

}
